package tk.mybatis.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.springboot.service.UserInfoService;

import java.util.concurrent.Callable;

@RestController
public class TestThreadTransactionController {


    @Autowired
    private UserInfoService userInfoService;

    @GetMapping(value = "/testThread1")
    public ModelMap saveNormal(String key) {
        ModelMap result = new ModelMap();
        // userInfoService.trancate();
        new Thread(() -> {
            userInfoService.testThreadLock(key);
        }).start();
        result.put("插入完毕 sum", "ddd");
        return result;
    }

}
